﻿using System;
using System.Collections.Generic;


public class ImplData : IDatas
{


	protected Dictionary<string, object> data = null;

	protected override int Deserialize()
	{

		if (string.IsNullOrEmpty(jsonText))
			return -1;

		data = MiniJSON.Json.Deserialize(jsonText) as Dictionary<string, object>;

		return 0;
	}

	public void Clear()
	{
		data = null;
		jsonText = "";
	}

    public virtual string Get(string key)
    {
        if (data.ContainsKey(key))
            return data[key].ToString();
        else
            return null;
    }

    public virtual string Get( string key1, string key2)
    {
        object ob = null;
        if (data.ContainsKey(key1))
            ob = data[key1];
        else
            return null;

        Dictionary<string, object> di = ob as Dictionary<string, object>;

        if (di.ContainsKey(key2))
        {
            object res = di[key2];
            if (res == null)
                return null;

            return res.ToString();
        }
        else
            return null;


    }

}


